import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import SvgIcon from '@/components/SvgIcon/index.vue'
const allGloablComponent = { SvgIcon }
export default {
  //务必叫做install方法
  install(app) {
    //将element-plus提供图标注册为全局组件
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
    // 注册项目全部的全局组件
    Object.keys(allGloablComponent).forEach(file => {
      // 注册为全局组件
      app.component(file, allGloablComponent[file])
    })
    // 获取vue版本号
    const version = Number(app.version.split('.')[0])
    if (version < 3) {
      console.warn('This plugin requires Vue 3')
    }
  },
}